using System;
using System.Collections.Generic;
using System.Text;
using SpriteCraft;
using System.Drawing;

namespace SpaceGame
{
  public abstract class Stage
  {
    protected EngineClass m_Engine;

    //The "safe area" coordinates, used to prevent 
    //the ship from going outside the screen.
    protected long m_Min_x;
    protected long m_Max_x;
    protected long m_Min_y;
    protected long m_Max_y;

    public long Min_x
    {
      get { return m_Min_x; }
      set { m_Min_x = value; }
    }
    public long Max_x
    {
      get { return m_Max_x; }
      set { m_Max_x = value; }
    }
    public long Min_y
    {
      get { return m_Min_y; }
      set { m_Min_y = value; }
    }
    public long Max_y
    {
      get { return m_Max_y; }
      set { m_Max_y = value; }
    }

    protected Enemy[] m_Enemies;

    public Stage(EngineClass engine)
    {
      m_Engine = engine;

      m_Min_x = 0;
      m_Min_y = 0;
      m_Max_x = engine.scrWidth - m_Min_x;
      m_Max_y = engine.scrHeight - m_Min_y;
    }

    public virtual void DoStuff(int tickdelta)
    {
      if (m_Engine.EvtIsKeyDown() && m_Engine.EvtKey() == tagKeyVal.Key_F10)
      {
        Random rand = new Random();
        new SmallStandardEnemy(m_Engine, this, new Point(rand.Next(m_Engine.scrWidth), rand.Next(m_Engine.scrHeight)));
      }

      if (m_Engine.EvtIsMouseDown() && m_Enemies[0] != null)
      {
        m_Enemies[0].GoToPoint(new Point(m_Engine.mouseX, m_Engine.mouseY));
      }
    }
  }

  public class StandardStage : Stage
  {
    public StandardStage(EngineClass engine) : base(engine)
    {
      m_Enemies = new Enemy[1];
      for (int i = 0; i < m_Enemies.Length; i++)
      {
        m_Enemies[i] = new SmallStandardEnemy(m_Engine, this);
      }
    }
  }
}
